package com.xinghanlaser.applet.base.common.annotation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author grandpa
 * @date 2023/3/20 14:25
 * @describe 枚举校验注解
 */
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {EnumValidator.class})
@Documented
public @interface EnumValidated {
    /**
     * 枚举的类型
     */
    Class<?> value();

    /**
     * 错误消息
     */
    String message() default "该值不在枚举类型中";

    /**
     * 获取枚举值的方法
     */
    String method() default "getType";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}